package com.cdsf.ribbonconsumer;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @Author: kennedy
 * @Date: Created in 11:19 2018/3/12
 */
@RestController
public class ConsumerController {
    @Autowired
    RestTemplate restTemplate;


    @RequestMapping("/ribbon-consumer")
    public String helloConsumer() {
        String response = restTemplate.getForEntity("http://CDSF-BASE/hello", String.class).getBody();
        return response;
    }
}
